// 普通的函数类型接口
interface SearchFunc {
    (source: string, subString: string): boolean;
}
let mySearch: SearchFunc;
mySearch = function(a:string,b:string){
    return a===b
}

// 普通的属性接口
interface Person extends SearchFunc{
    name: string;
    age: number;
    eat(food:string): void;
}

// 混合类型需要用一个函数创建对应的对象去返回这个接口签名定义的一个复杂对象
function createPerson():Person{
    let p = <Person>function(a:string,b:string){
        return a===b
    }
    p.name = 'Tom';
    p.age = 25;
    p.eat = function(food: string) {
        console.log(this.name + ' is eating ' + food);
    }
    return p;
}
let hh = createPerson()
console.log(hh.name)
hh.eat('apple')
console.log(hh('1','2'))    